<?php
	$formtemplate = "";
	if (isset($_REQUEST['formtemplate']))
		$formtemplate = $_REQUEST['formtemplate'];

?>
<table id="maintable" cellspacing="0">

<tr>
	<td id="spacercol"></td>
	<td id="logocell" align="right"><a href="index.php"><img src="images/cplogo.png" border="0" alt="<?php echo $siteDescription; ?>" /></a></td>
		<td id="entrycell">
				<img src="images/cplogo.png" width="796px" height="0" />
				<form action="post.php?start=forms" action="post">
				<table>
				<tr>
				<td>What's <a href="listing.php?arg=hap">--hap:</a>?</td>
				<td align="right"></td>
				</tr>
				<tr>
				<td colspan="2">
<?php
//this is where the form is created.
	include_once("forms/".$formtemplate.".php");
	$counter = 1;
	foreach($formentry as $formitem)
	{
?>
		<div><?php echo $formitem[1]; ?></div>
<?php
		if ($formitem[0]==1) //textsmall
		{
?>
			<input type="text" size="10" name="textsmall<?php echo $counter; ?>" value="" />
<?php
		}
		else if ($formitem[0] == 2) //textbig
		{
?>
			<textarea size="25" name="textbig<?php echo $counter; ?>"></textarea>
<?php
		}
		else if ($formitem[0] == 3) //updown
		{
?>
			<input type="text" size="3" name="updown<?php echo $counter; ?>" value="" />
<?php
		}
		else if ($formitem[0] == 4) //colorpicker
		{
?>
			<input type="text" size="3" name="colorpicker<?php echo $counter; ?>" value="" />
<?php
		}
		else if ($formitem[0] == 5) //select
		{
?>
			<select name="select<?php echo $counter; ?>">
<?php
			foreach ($formitem[2] as $formoption)
			{
?>
				<option value="<?php echo $formoption; ?>"><?php echo $formoption; ?></option>
<?php
			}
?>
			</select>
<?php
		}
		$counter++;
	}
?>
				</td>
				</tr>
				<tr>
				<td align="right" colspan="2">
<?php

if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret']))
{
?>
<a href="./toath/redirect.php"><img src="./toath/images/lighter.png" alt="Sign in with Twitter" border="0" /></a>
<?php
}
else
{

?>
<a href="./toath/clearsessions.php" id="signoutlink">Sign out</a><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
				<input type="submit" value="update" />
<?php
}
?>
				</td>
				</tr>
				</table>
			</form> 
		</td>
		
	<td id="spacercol"></td>
</tr>
</table>
